package com.cn.wanxi.service.impl;

import com.cn.wanxi.dao.ProductDao;
import com.cn.wanxi.dao.impl.ProductImpl;
import com.cn.wanxi.model.ProductModel;
import com.cn.wanxi.model.ResultModel;
import com.cn.wanxi.service.IproductService;

import java.util.List;

public class ProductServiceImpl implements IproductService {
    @Override
    public List<ProductModel> getList() {
        ProductDao productDao = new ProductImpl();
        return productDao.getList();
    }

    @Override
    public ResultModel findAll() {
        ResultModel resultModel = new ResultModel();
        ProductDao productDao = new ProductImpl();
        resultModel.setObject(productDao.findAll());
        return resultModel;
    }

    @Override
    public ResultModel add(ProductModel productModel) {
        ProductDao productDao = new ProductImpl();
        ResultModel resultModel = new ResultModel();
        resultModel.setObject(productDao.add(productModel));
        return resultModel;
    }
}
